package com.fmy.springbootsecurity.modular;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fmy.response.call.ResponseCall;
import com.fmy.response.specs.Response;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Mr.fmy
 * @version 1.0.0
 * @ClassName TestController.java
 * @Description TODO
 * @createTime 2019年07月08日 09:28:00
 */
@RestController
public class TestController {

    @GetMapping("/hello")
    public Map hello() {
        Map<String, Object> map = new HashMap<>(1);
        map.put("user_name", SecurityContextHolder.getContext().getAuthentication().getName());
        return map;
    }
}
